package video.local.analyse.stereo;

import java.io.IOException;

import exception.ImageNotFoundException;

public class VideoStereoSimilarity {
	private String videoFilePath;
	private double tolerant=0.9;	//fault tolerant (100% means all frame must be qualified )
	private double threshold=0.8;
	
	public VideoStereoSimilarity(String videoFilePath){
		this.videoFilePath = videoFilePath;
	}
	
	public void setTolerant(double tolerant){
		this.tolerant = tolerant;
	}
	
	public void setTheshold(double threshold){
		this.threshold = threshold;
	}
	
	public boolean isStereo() throws ImageNotFoundException{
		VideoScreenshots vs = new VideoScreenshots( videoFilePath );
		int qualify = 0;
		for(int i=0; i<vs.LRs.length; i++){
			if(vs.LRs[i] >= threshold){
				qualify++;
			}
		}
		if( (double)qualify/vs.LRs.length >= tolerant)
			return true;
		return false;
	}
}
